﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;

using Fuse8.DomainFramework.Common;

using Fuse8.ContentManagementFramework.Domain;

namespace Fuse8.ContentManagementFramework.Administration.Models
{
    [Serializable]
    public class CmsAdminWorkflowSendForApprovalModel
    {
        public int EntityId { get; set; }

        public Guid WorkflowId { get; set; }

        public int WorkflowTransitionId { get; set; }
        
        public bool SendNotification { get; set; }

        public IEnumerable<dynamic> AssignedUser { get; set; }        

        public CmsAdminWorkflowSendForApprovalModel(IEnumerable<CmsUser> users)
        {
            Guard.ArgumentNotNull(users, "users");

            AssignedUser = new SelectList(users, "Id", "UserName");

            SendNotification = true;
        }
    }

    [Serializable]
    public class CmsAdminWorkflowReassignForApprovalModel
    {
        public int? AssignedUserId { get; set; }
        
        public IEnumerable<dynamic> AllUsers { get; set; }

        public bool SendNotification { get; set; }

        public CmsAdminWorkflowReassignForApprovalModel(IEnumerable<CmsUser> users)
        {
            Guard.ArgumentNotNull(users, "users");

            AllUsers = new SelectList(users, "Id", "UserName");

            SendNotification = true;
        }
    }

    [Serializable]
    public class CmsAdminWorkflowBaseModel
    {
        public int Id { get; set; }
        
        public string Title { get; set; }

        public int Cycle { get; set; }

        public int State { get; set; }

        public string Status { get; set; }

        public string EntityType { get; set; }
    }

    [Serializable]
    public class CmsAdminWorkflowDraftModel : CmsAdminWorkflowBaseModel
    {
        public DateTime? ApprovalDate { get; set; }   
    }

    [Serializable]
    public class CmsAdminWorkflowActiveModel : CmsAdminWorkflowDraftModel
    {
        public int? UserGroupId { get; set; }

        public int? UserId { get; set; }

        public string UserGroup { get; set; }
        
        public string User { get; set; }

        public Dictionary<int, string> AvailableTransitions { get; set; }

        public IEnumerable<CmsUser> Users { get; set; }
    }

    [Serializable]
    public class CmsAdminWorkflowApprovedModel : CmsAdminWorkflowBaseModel
    {
        public DateTime PublishedDate { get; set; }
    }
}